<!DOCTYPE html>
<html lang="en">
<head>
    
    <meta charset="utf-8">
    <title>tools.js - Documentation</title>
    
    
    
        <meta name="keywords" content="webpack ES6 " />
        <meta name="keyword" content="webpack ES6 " />
    
    
    
    <meta property="og:title" content="test2"/>
    <meta property="og:type" content="website"/>
    <meta property="og:image" content=""/>
    
    <meta property="og:url" content=""/>
    
    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
    <script src="scripts/nav.js" defer></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav class="wrap">
    
    <input type="text" id="nav-search" placeholder="Search" />
    
    <h2><a href="index.html">Home</a></h2><h2><a href="https://gitee.com/shanliangdeYWJ" target="_blank" class="menu-item" id="website_link" >码云shanliangdeYWJ</a></h2><h3>Tutorials</h3><ul><li><a href="tutorial-Overview.html">Overview</a></li></ul><h3>Namespaces</h3><ul><li><a href="initCompute.html">initCompute</a><ul class='methods'><li data-type='method' style='display: none;'><a href="initCompute.html#.div">div</a></li><li data-type='method' style='display: none;'><a href="initCompute.html#.minus">minus</a></li><li data-type='method' style='display: none;'><a href="initCompute.html#.mul">mul</a></li><li data-type='method' style='display: none;'><a href="initCompute.html#.plus">plus</a></li></ul></li><li><a href="initTools.html">initTools</a><ul class='methods'><li data-type='method' style='display: none;'><a href="initTools.html#.digitalize">digitalize</a></li><li data-type='method' style='display: none;'><a href="initTools.html#.getTarget">getTarget</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#bindEvent">bindEvent</a></li><li><a href="global.html#init">init</a></li><li><a href="global.html#oBtnClick">oBtnClick</a></li><li><a href="global.html#oBtnGroup">oBtnGroup</a></li><li><a href="global.html#oCalculator">oCalculator</a></li><li><a href="global.html#oInputs">oInputs</a></li><li><a href="global.html#oResult">oResult</a></li><li><a href="global.html#renderResult">renderResult</a></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">tools.js</h1>
    

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>/**
 * @author 善良的YWJ
 * @Created by shanliangdeYWJ on 2020/11/29 17:38:38
 * @file initTools.js
 * @description
 * ```js
 * 工具函数
 * ``` 
 * see {@link initTools}
 * ```js
 * initTools.digitalize(str) 
 * initTools.getTarget(ev) 
 * ```
 * see {@link initCompute}
 * ```js
 * initCompute.plus(2, 3)
 * initCompute.minus(2, 3)
 * initCompute.mul(2, 3)
 * initCompute.div(2, 3)
 * ```
 * @link [Github](https://github.com/shanliangdeYWJ)
 */

/**
 * 工具类
 * @namespace
 * @description
 * ```js
 * initTools.digitalize(str) 
 * initTools.getTarget(ev) 
 * ```
 */
var initTools = (function () {

    /**
     * 文字去除空格转化成数字
     * @method digitalize
     * @param {string} str 数字字符串 | 字符串
     * @return {number|0} 数字 | 0
     * @memberof initTools
     */
    function digitalize(str) {
        str = str || ''
        return Number(str.replace(/\s+/g, '')) || 0;
    }

    /**
     * 返回事件对象
     * @method getTarget
     * @param {event} ev 事件
     * @return {EventTarget} 事件对象
     * @memberof initTools
     */
    function getTarget(ev) {
        var e = ev || window.event;
        return e.target || e.srcElement;
    }

    return {
        digitalize: digitalize,
        getTarget: getTarget
    };
})();
/**
 * 工具类
 * @namespace
 * @description
 * ```js
 * initCompute.plus(2, 3)
 * initCompute.minus(2, 3)
 * initCompute.mul(2, 3)
 * initCompute.div(2, 3)
 * ```
 */
var initCompute = (function () {

    /**
     * 加法运算 加数 + 加数 = 和
     * @method plus
     * @param {number} a 加数
     * @param {number} b 加数
     * @return {number} 和
     * @memberof initCompute
     */
    function plus(a, b) { return a + b; };

    /**
     * 减法运算 被减数 - 被减数 = 差
     * @method minus
     * @param {number} a 被减数
     * @param {number} b 减数
     * @return {number} 差
     * @memberof initCompute
     */
    function minus(a, b) { return a - b; };

    /**
     * 乘法运算  因数 × 因数 = 积
     * @method mul
     * @param {number} a 因数
     * @param {number} b 因数
     * @return {number} 积
     * @memberof initCompute
     */
    function mul(a, b) { return a * b; };

    /**
     * 除法运算 被除数 ÷ 除数 = 商
     * @method div
     * @param {number} a 被除数
     * @param {number} b 除数
     * @return {number} 商
     * @memberof initCompute
     */
    function div(a, b) { return a / b; };

    return {
        plus: plus,
        minus: minus,
        mul: mul,
        div: div
    };
})();
</code></pre>
        </article>
    </section>




    
    
</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Dec 01 2020 08:42:14 GMT+0800 (GMT+08:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>

<script src="scripts/search.js" defer></script>


<script src="scripts/collapse.js" defer></script>


    <link type="text/css" rel="stylesheet" href="./shanliangdeYWJ.css">
    
</body>
</html>
